#include "Upgrades.h"
#include "Player.h"
#include "../SGD Wrappers/SGD_AudioManager.h"

Upgrades::Upgrades()
{
	m_pOwner = nullptr;
	m_aAudio = SGD::AudioManager::GetInstance()->LoadAudio("resource/audio/Upgrade_Pickup.wav");
}

Upgrades::~Upgrades()
{
	SGD::AudioManager::GetInstance()->UnloadAudio(m_aAudio);
	m_aAudio = SGD::INVALID_HANDLE;
	delete m_pOwner;
}

void Upgrades::HandleCollision(BaseObject* pOther)
{
	if (!SGD::AudioManager::GetInstance()->IsAudioPlaying(m_aAudio) && dynamic_cast<Player*>(pOther))
		SGD::AudioManager::GetInstance()->PlayAudio(m_aAudio);
}